home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Magazin/MacEasy 11
/
Mac Magazin and MacEasy Magazine CD - Issue 11.iso
/
Sharewarebibliothek
/
Spiele
/
Tic Tac Toe ƒ
/
tictactoe.readme
< prev
Wrap
Text File
|
1994-06-10
|
7KB
|
194 lines
This is the updated documentation for the Tic Tac Toe Game written by Joel
Weight
This game was written as a final project for Russell Baird's Computer
Science 112 class at Snow College, Ephraim Utah. It was written during
pretty much all of Spring quarter, 1994. It was finally compiled on June
6. I hope you all enjoy it.
In case you were wondering, the original documentation exists only in hard
copy, and solely for the purpose of a grade. Most of this documentation is
for that same purpose, but if any of it helps any of you, then yippeee I
will feel like it was all worth while.
INSTALLATION
This is much easier now. You don't have to get into Think Pascal to
start the game. In order to get into the game, all you must do is double
click on the Application titled Tic Tac Toe 1.1. This will bring up a
window with the Tic Tac Toe board drawn in it, and you can immediately
start playing.
HOW TO USE THE PROGRAM
There are a few changes here too. First, the window is no longer modal.
It is movable and resizable. In order to resize it, just grab it by the
bottom right, like you would any other window, and drag it to the size that
you want. Placing an X or an O is the same. Simply click in the square
that you want the X or O to be in. The cursor will resemble the piece that
will be placed.
There have been some changes to the the menu. Now, there are only three
choices in the file menu. New, Close, and Quit. Every option is
functional and has default behavior. In the Edit menu, the only option
that will be enabled that applies to Tic Tac Toe is the Clear option. This
will clear all of the X's and O's in the current Tic Tac Toe window, and
allow you to play again on the same board rather than having to get a new
window as in the last version.
******************************************
TECHNICAL DOCUMENTATION
This is the the text about the code that I wrote. If you just going to
play this game for fun, then you don't have to read this.
***CTICTACTOEWINDOW***
Heritage
Superclass : CWindow
Subclass : none
Using CTICTACTOEWINDOW
This was written so that I could have some instance variables of my
gamepanes in an array that resembled the board. In order to use it, you
must have the CGamePane type, and the CSquarePane type so that the window
can create those panes.
Variables
itsGamePane : CGamePane
this variable is a pane that fills the entire window, and encloses all of
the SquarePanes.
itsSquarePanes : Array [(left, middle, right), (top, center, bottom)] of
CSquarePane
This is an array of the squarepanes that are the boxes that the X's and O's
go in. They are arranged 3 by 3 in itsGamePane.
Methods
Procedure ITicTacToeWindow (WINDid: integer; asupervisor : CDirector);
initializes a tictactoewindow. In this method, the createpanes method
is called.
it calls the inherited IWindow method which sets up a window with the
WINDid window id, not floating, an enclosure which is the global variable
gdesktop, and a supervisor that was passed to the method.
Procedure CreatePanes;
This method does just that, it creates the panes, those being
itsGamePane, and all of the panes in the itsSquarePanes array. It places
them on the screen in the initial configuration too.
Procedure ChangeSize (width, height : integer);
This method had to be overridden so that it would place all of
itsSquarePanes in the correct place when the window was resized. It
accounts for the width of the lines, so that the panes don't overlap those,
and then it accounts for the other panes, so that they don't overlap each
other.
Procedure clear;
This method sends a clearpane method to all of itsSquarePanes.
***CGGAMEPANE***
Heritage
superclass : CPane
subclass : none
Using CGamePane
This is a descendant of CPane that has variables to keep track of the
current piece so that the Tic Tac Toe game can draw the correct one. I
don't know that you will ever want to use this.
Variables
thepiece : char;
this represents the piece that is currently being played, either X or O.
thecurrentcursor : integer;
this is the cursor that corresponds to the piece. It refers to the ID
of either the X cursor or the O cursor, that is why it is of type integer.
Methods
Procedure IGamePane (anEnclosure:CView; aSupervisor:CBureaucrat);
Initializes a game pane and fits it to the enclosure. The game pane is
elastic both vertically and horizontally. This sets thepiece variable to
'X' and thecurrentcurso to the XcursorID
Procedure Draw (Var area : rect);
Draws the lines of a traditional tic tac toe board, to the limits of the
gamepane. You shouldn't need to call this, because it is automatically
called with a refresh, and it will figure where to put the lines when the
window is resized.
Function currentpiece : char;
Returns thepiece.
Procedure changepiece;
thepiece variable is changed from X to O or from O to X, and calls
changecursor.
Procedure changecursor;
Calls setcursor to set the cursor to match thepiece.
***CSQUAREPANE***
Using CSQUAREPANE
In order to use this, you must have the Ctictactoewindow, and the
cgamepane. It relies on those in several of the methods. The Csquarepane
and the cgamepane are very dependant on each other, in that the csquarepane
accesses some of cgamepane's variables so that it can know what to do.
variables
itsfull : boolean;
this is true if the mouse has been clicked within the pane.
itspiece : char;
this tells which piece was drawn in the pane, if any. it is either an X
or an O
itsgamepane : cgamepane;
this is so that you can get to the methods of the gamepane that the
squarepane is in.
methods
Procedure ISquarePane (anEnclosure : CView; aSupervisor : CBureaucrat;
aHEncl, aVEncl : integer; thegamepane : cgamepane);
this calls the inherited IPane. The enclosure is anEnclosure, the
Supervisor is aSupervisor, awidth is 90, aheight is 90, ahencl and avencl
are ahencl and avencl respectively, and it is elastic both vertically and
horizontally. ISquarePane sets itsfull to false, itspiece to ' ' and tells
it that it wants clicks.
Function full : boolean;
this returns the contents of the itsfull variable
Procedure DoClick (hitPt : point; modifierKeys : integer; when : longint);
if the pane is not full, then it will set itspiece to
itsgamepane.currentpiece, then it puts the picture corresponding to
itspiece in the pane, changes the piece, changes teh cursor, and sets
itsfull to true. None of the variables are really used in my method.
Procedure Draw (Var area: rect);
Draws an X, an O, or nothing, depending on what itspiece is.
Procedure ClearPane;
Sets all of the variables back to what they were when they were
initialized, those being itsfull := false, itspiece := ' ', and then it
calls a refresh so that the draw method will get rid of any X's or O's.
Procedure adjustcursor (where : point; mousergn : rgnhandle);
calls changecursor so that the cursor resembles the piece, (X or O),
unless the pane is full, then it has default behavior in that the cursor is
an arrow.
Procedure resizeframe (delta:rect);
Resizes the frame only approximately one third of what it would normally
so that the panes don't overlap each other, or the lines.
***THE END***